<?php

class Webmix_Form_Company_Upload extends Engine_Form
{
  public function init()
  {
  
    $this->clearDecorators()
      ->addDecorator('FormElements')
      ->addDecorator('Form')
//      ->setAttrib('class', 'upload-form')
      ->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));  

    $this
      ->setAttrib('enctype', 'multipart/form-data')
      ->setAttrib('id', 'UploadForm');

    $this->addElement('File', 'image', array(
      'label' => 'Choose a photo',
      'destination' => APPLICATION_PATH.'/public/temporary/',
      'multiFile' => 1,
      'validators' => array(
        array('Count', false, 1),
        array('Extension', false, 'jpg,png,gif,jpeg'),
      )
      
    ));
    
       $this->addElement('Hidden', 'uploadPhoto', array('order' => 99));    
       $this->addElement('Hidden', 'file_id', array('order' => 100));
       $this->addElement('Hidden', 'file_url', array('order' => 101));      

//        $this->addElement('button','preview',
//        array(
//            'label' => 'Preview',
//            'onclick' => 'previewImage()',
//			'decorators' => array (
//				'ViewHelper'
//			)        
//        ));

        $this->addElement('button','upload',
        array(
            'label' => 'Save',
            'onclick' => 'submitImage()',
			'decorators' => array (
				'ViewHelper'
			)        
        ));
        

  
  }
}